package com.ex.shapejudge;

import com.ex.question.base.ShapeJudgeQuestion;

public class TriangleJudgeQuestion extends ShapeJudgeQuestion {

	int mBorderA;
	int mBorderB;
	int mBorderC;

	public int getBorderA() {
		return mBorderA;
	}

	public void setBorderA(int borderA) {
		mBorderA = borderA;
	}

	public int getBorderB() {
		return mBorderB;
	}

	public void setBorderB(int borderB) {
		mBorderB = borderB;
	}

	public int getBorderC() {
		return mBorderC;
	}

	public void setBorderC(int borderC) {
		mBorderC = borderC;
	}

	public TriangleJudgeQuestion() {
		mQuestionTypeName = "三角形判断题";
		this.createQuestion();
	}

	public TriangleJudgeQuestion(int a, int b, int c) {
		mQuestionTypeName = "三角形判断题";
		this.createQuestion(a, b, c);
	}

	public boolean Judge() {
		if (((mBorderB + mBorderC) > mBorderA) && ((mBorderA + mBorderC) > mBorderB)
				&& ((mBorderB + mBorderA) > mBorderC))
			return true;
		else
			return false;
	}

	public enum TriangleType {
		NotTriangle, Equilateral, Scalene, Isosceles
	}

	public TriangleType JudgeType() {
		if (!this.Judge())
			return TriangleType.NotTriangle;
		else {
			if ((mBorderA == mBorderB) && (mBorderB == mBorderC))
				return TriangleType.Equilateral;
			else if ((mBorderA != mBorderB) && (mBorderB != mBorderC) && (mBorderC != mBorderA))
				return TriangleType.Scalene;
			else
				return TriangleType.Isosceles;
		}
	}

	public void createQuestion() {
		createQuestion(mRand.getRandom100(), mRand.getRandom100(), mRand.getRandom100());
	}

	public void createQuestion(int a, int b, int c) {
		mBorderA = a;
		mBorderB = b;
		mBorderC = c;
		mRightAnswer = Judge();
	}
}